package net.rokyinfo.basedao.dao;

import net.rokyinfo.basedao.entity.User;
import net.rokyinfo.basedao.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Administrator on 2016/8/2.
 */
@Repository("userDao")
public class UserDao {

    @Autowired
    private UserMapper userMapper;

    public List<User> getAll(){
        return userMapper.getAll();
    }

    public User getUserById(long id) {
        return userMapper.getUserById(id);
    }

    public User getUserByMobile(String mobile) {

        return userMapper.getUserByMobile(mobile);
    }

    public void updatePassword(String mobile, String password, String md5Password) {

        userMapper.updatePassword(mobile, password, md5Password);
    }

    public List<User> getUserByNickname(String nickname) {

        return userMapper.getUserByNickname(nickname);
    }

    public void addUser(User user) {

        userMapper.addUser(user);
    }

    public void updateLockPassword(String mobile, int lockType, String lockPassword) {

        userMapper.updateLockPassword(mobile, lockType, lockPassword);
    }

    public void updateUserGender(long userId, int gender) {

        userMapper.updateUserGender(userId, gender);
    }

    public void updateUserNickname(long userId, String nickname) {

        userMapper.updateUserNickname(userId, nickname);
    }

    public void updateUserHeadImgUrl(long userId, String headImgUrl) {

        userMapper.updateUserHeadImgUrl(userId, headImgUrl);
    }
}
